package com.game.cards.traps;

import com.game.cards.MonsterCard;
import com.game.cards.TrapCard;
import com.game.play.Events;
import com.game.play.Game;

public class AttackDown extends TrapCard {

	public AttackDown()
	{
		this.title = "Attack Down";
		this.description = "When an enemy monster attacks one of your monsters \n" +
		"They lose 1000 ATK points permanently.";
		
		this.trigger = Events.attackmonster;
	}
	public boolean test(Game game)
	{
		String[] arg = game.getCurrentTurn().getAq().getEventArgs(this.trigger);
		MonsterCard f = (MonsterCard) game.getCardById(Integer.valueOf(arg[1]));
		
		if (f.getDeck().getOwner() != this.getDeck().getOwner())
		{
			f.setAttack(f.getAttack()-1000);
			if (f.getAttack() < 0) f.setAttack(0);
			
			System.out.println(f.getTitle() + " had it's attack lowered!");
			this.getDeck().getOwner().getField().removeSpellTrapById(this.id);
			return true;
		}
		
		return false;
	}

}
